﻿@{
    ViewBag.Title = "AddOrder";
    Layout = "~/Views/Shared/Template.cshtml";
}

@using Partner.MVC.Models;
@{
    var user = Session["LoginUser"] as User_Info;
}

<div style="height: 300px;width: 100%;background:url(/static/hbweb/images/me.jpg);">
    <div class="container">
        <div class="header-message">
            <img class="fl" src="http://pic.huobanchina.com/o_1bp7omfg8e821pc4bbg1u8g1ifl9.jpeg" alt="" />
            <div class="fl header-text">
                <h3 class="user-name">@user.Use_Name </h3>
                <i class="icon-fabu3 point user-namei"></i>
            </div>
            <a id="AlterPwd" style="width:85px;" data-toggle="modal" data-target="#myModal" class="fr fn-font-hover-blue change change-password">
                修改密码
            </a>
        </div>
    </div>
</div>

<style>
    td {
        width: 400px;
    }
</style>

<div class="bgcSil">
    <div class="container">
        <div class="mt30" style="width: 100%">
            <ul id="divLeft" style="width:24%" class="nav navbar-nav"></ul>
            <div id="divContent" style="width:75%;" class="fr mb80 cont bgcWhit news-list-con">
                <div class="personal_info" style="width:70%;margin:0 auto;">
                    <h2 class="title" style="text-align:center;color:#0094ff;">添加订单</h2>
                    <div class="fb_box">
                        <form action="/UserCenter/AddOrderDo">
                            <table class="table table-striped table-bordered table-hover table-condensed">
                                <tr>
                                    <td style="text-align:right;"><span class="c-red">服务名称：</span></td>
                                    <td>
                                        <input type="hidden" value="@Model.S_Id" name="S_Id" />
                                        <input readonly value="@Model.S_Type" type="text" class="form-control" maxlength='11' style="width:200px;">
                                    </td>
                                </tr>
                                <tr>
                                    <td style="text-align:right;"><span>公司名称：</span></td>
                                    <td><input name="O_Company" readonly value="@Model.S_Name" type="text" class="form-control" maxlength='11' style="width:200px;"></td>
                                </tr>
                                <tr>
                                    <td style="text-align:right;"><span>单价：</span></td>
                                    <td>
                                        <input id="Price" name="O_Price" value="@Model.S_Price" type="text" class="form-control" maxlength='11' style="width:200px;">
                                    </td>
                                </tr>
                                <tr>
                                    <td style="text-align:right;"><span>数量：</span></td>
                                    <td>
                                        <input onkeyup="zongjia()" id="Num" name="O_Num" type="text" class="form-control" maxlength='11' style="width:200px;"><span style="color:red" id="NumReg"></span>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="text-align:right;">总价：</td>
                                    <td>
                                        <input id="Sum" value="" disabled type="text" class="form-control" maxlength='11' style="width:200px;">
                                    </td>
                                </tr>
                                <tr>
                                    <td style="text-align:right;"><span>操作：</span></td>
                                    <td style="text-align:left;"><input type="submit" id="DoOrder" value="立即下单" style="width:200px;height:30px;background:#0094ff;color:white;" /></td>
                                </tr>
                            </table>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    ParentNav();
    // 绑定根节点
    function ParentNav() {
        $.ajax({
            type: "post",
            url: "/Partner/LeftNav",
            dataType: "json",
            success: function (data) {
                var htmltab = "";
                for (var i = 0; i < data.length; i++) {
                    htmltab += "<li class=\"dropdown\"><a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\" style=\"width: 175px;font-size: 16px;\">" + data[i].Lar_Name + "</a>" + SonNav(data[i].Limit_Id) + "</li>";
                }
                $("#divLeft").append(htmltab);
            },
            error: function (err) {
                alert(err);
            }
        })
    }
    // 绑定子节点
    function SonNav(id) {
        var html1 = "";
        $.ajax({
            type: "post",
            url: "/Partner/LeftSon",
            data: { pid: id },
            dataType: "json",
            async: false,
            success: function (data) {
                var strhtml = "<ul class=\"dropdown-menu\">"
                for (var i = 0; i < data.length; i++) {
                    strhtml += "<li><a href=\"" + data[i].Limit_Url + "\">" + data[i].Limit_Name + "</a></li>"
                }
                strhtml += "</ul>";
                html1 = strhtml;
            }
        })
        return html1;
    }
</script>

<script>
    $("#DoOrder").hide();
    function zongjia() {
        var Price = $("#Price").val();
        var Num = $("#Num").val();
        $("#Sum").val(Price * Num);
    }
    $("#Num").blur(function () {
        var Num = $("#Num").val();
        var DoOrder = $("#DoOrder").val();
        var reg = /^[1-9]\d*$/;
        if (!reg.test(Num)) {
            alert("数量格式不正确");
            $("#DoOrder").hide();
        }
        else {
            $("#DoOrder").show();
        }
    })

</script>

